<?php
$r = load('review.class.php','shop');
if(!$action) $action = 'add';



switch ($action){
    case 'add':
        if($dosubmit){
            if(!$shopid) err('缺少必要参数！');
            if(strlen($content)<$DC[review][min] || strlen($content)>$DC[review][max]) err("回应内容应在".$DC[review][min]."与".$DC[review][max]."之间！");

            //添加评论
            $review[userid] = $_SESSION['userid'];
            $review[username] = $_SESSION['username'];
            $review[shopid] = $shopid;
            $review[areacode] = $acode;
            $review[sort1] = $sort1;
            $review[sort2] = $sort2;
            $review[sort3] = $sort3;
            $review[sort4] = $sort4;
            $review[sort5] = $sort5;
            $review[sort6] = $sort6;
            $review[sort7] = $sort7;
            $review[sort8] = $sort8;
            $review[avgprice] = $avgprice;
            $review[content] = nl2br(trim(new_htmlspecialchars($content)));

            $r->add($review);

            err("点评发布成功！",'green');
        }
    break;


    case 'list':
        //商铺点评
        $shopname = gb2u(shopname($shopid));

        $pagesize = 10;
        $page = $page ? $page : 1;
        $shopreviews = $r->listinfo(" status=1 AND shopid=$shopid ",' id DESC',$page,$pagesize);
        $num = $r->allnumber;
        $pages = m_pages($rnum, $page, 'index.php?file='.$file.'&amp;shopid='.$shopid.$cityparam.'&amp;page=', $pagesize);
        array2utf8($shopreviews);

        include mtpl('reviewlist');
    break;


}

?>